package Work2;
import java.util.ArrayList;
import java.util.Scanner;

public class IsSamenum {
	public static void main(String[] args) {
		ArrayList<Integer> arr = creatnum();
		Issame(arr);
	}
	
	public static ArrayList<Integer> creatnum() {
		Scanner sc = new Scanner(System.in);
		ArrayList<Integer> arr = new ArrayList<Integer>();
		System.out.println("请输入整数的个数");
		int num = sc.nextInt();
		System.out.println("请输入整数");
		for(int i=0;i<num;i++) {
			arr.add(sc.nextInt());
		}
		return arr;
	}
	
	public static void Issame(ArrayList<Integer> arr) {
		int t=1;
		for(int i=1;i<arr.size();i++) {
			if(arr.get(i) == arr.get(i-1)) {
				t++;
				if(t>=4) {
					System.out.println("这些整数有4个连续相等的数");
					return;
				}
			} else {
				t=1;
			}
		}
		System.out.println("这些整数没有4个连续相等的数");
	}
}
